package com.b511.swpu.cementbackend.entity;

import com.fasterxml.jackson.annotation.JsonIgnore;
import lombok.*;
import lombok.experimental.Accessors;
import org.hibernate.annotations.DynamicInsert;
import org.hibernate.annotations.DynamicUpdate;
import org.springframework.format.annotation.DateTimeFormat;

import javax.persistence.*;
import java.util.Date;
import java.util.List;

@Entity
@Getter
@Setter
@NoArgsConstructor
@AllArgsConstructor
@Data
@EqualsAndHashCode
@DynamicUpdate
@DynamicInsert
@Accessors(chain = true)
// 对应数据库表 BA_WELL
@Table(name = "BA_WELL")

public class BA_Well extends BABaseEntity {

    // TODO: 数据库新建队列 & 设定Trigger 实现自增
    @Id
    @SequenceGenerator(name = "INCREMENT_SEQUENCEs", sequenceName = "INCREMENT_SEQUENCE",allocationSize = 1)
    @GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "INCREMENT_SEQUENCEs")
    @Column(name = "BA_WELL_ID")
    private Long BA_WELL_ID;

    @Basic
    @Column(name = "COUNTRY")
    private String country;

    @Basic
    @Column(name = "AREA")
    private String area;

    @Basic
    @Column(name = "BLOCK")
    private String block;

    @Basic
    @Column(name = "OILFIELD")
    private String oilField;

    @Basic
    @Column(name = "GEOGRAPHICALPOSITION")
    private String geographicalPosition;

    @Basic
    @Column(name = "STRUCTURALLOCATION")
    private String structuralLocation;

    @Basic
    @Column(name = "WELLHEADX")
    private String wellheadX;

    @Basic
    @Column(name = "WELLHEADY")
    private String wellheadY;

    @Basic
    @Column(name = "WELLHEADLONGITUDE")
    private String wellheadLongitude;

    @Basic
    @Column(name = "WELLHEADLATITUDE")
    private String wellheadLatitude;

    @Basic
    @Column(name = "WATERDEPTH")
    private Double waterDepth;

    @Basic
    @Column(name = "MUDLINE")
    private Double mudLine;

    @Basic
    @Column(name = "BUSHINGALTI")
    private Double bushingAlti;

    @Basic
    @Column(name = "WELLTYPE")
    private String wellType;

    @Basic
    @Column(name = "WELLSPACING")
    private String wellSpacing;

    @Basic
    @Column(name = "WELLCATEGORY")
    private String wellCategory;

    @Basic
    @Column(name = "ISLANDWELL")
    private String isLandWell;

    @Basic
    @Column(name = "DRILLINGPLATFORM")
    private String drillingPlatform;

    @Basic
    @Column(name = "DRILLINGPLATFORMTYPE")
    private String drillingPlatformType;

    @Basic
    @Column(name = "RISEROD")
    private Double riserOD;

    @Basic
    @Column(name = "RISERID")
    private Double riserID;

    @Basic
    @Column(name = "RISERDEPTH")
    private Double riserDepth;

    @Basic
    @Column(name = "BOREHOLECOMPANY")
    private String boreholeCompany;

    @Basic
    @Column(name = "MUDCOMPANY")
    private String mudCompany;

    @Basic
    @Column(name = "CEMENTCOMPANY")
    private String cementCompany;

    @Basic
    @Column(name = "OPERATOR")
    private String operator;

    @Basic
    @Column(name = "OPERATORDEPUTY")
    private String operatorDeputy;

    @Basic
    @Column(name = "DESIGNDEPTH")
    private Double designDepth;

    @Basic
    @Column(name = "DESIGNVERTICAL")
    private Double designVertical;

    @Basic
    @Column(name = "DRILLINGGOAL")
    private String drillingGoal;

    @Basic
    @Column(name = "SIDEDRILLINGPOINT")
    private String sideDrillingPoint;

    @Temporal(TemporalType.DATE)
    @DateTimeFormat(pattern = "yyyy-MM-dd")
    @Basic
    @Column(name = "DRILLINGSTARTTIME")
    private Date drillingStartTime;

    @Temporal(TemporalType.DATE)
    @DateTimeFormat(pattern = "yyyy-MM-dd")
    @Basic
    @Column(name = "DRILLINGFINISHTIME")
    private Date drillingFinishTime;

    @Basic
    @Column(name = "DRILLINGPERIOD")
    private Double drillingPeriod;

    @Basic
    @Column(name = "CONSTRUCTIONPERIOD")
    private Double constructionPeriod;

    @Basic
    @Column(name = "DRILLINGDEPTH")
    private Double drillingDepth;

    @Basic
    @Column(name = "DRILLINGVERTICALDEPTH")
    private Double drillingVerticalDepth;

    @Basic
    @Column(name = "ACTUALWELLDEPTH")
    private Double actualWellDepth;

    @Basic
    @Column(name = "ACTUALVERTICAL")
    private Double actualVertical;

    @Basic
    @Column(name = "WKLOLEDRILLINGHORIZON")
    private String wkloleDrillingHorizon;

    @Basic
    @Column(name = "PRINCIPLE")
    private String principle;

    @Basic
    @Column(name = "COMPLETIONMETHOD")
    private String completionMethod;

    @Basic
    @Column(name = "AVERAGESPEED")
    private Double averageSpeed;

    @Basic
    @Column(name = "CORINGFOOTAGE")
    private Double coringFootage;

    @Basic
    @Column(name = "CORERATE")
    private Double coreRate;

    /**
     * 井筒目的层(一对多) BA_TARGETSTRATUM
     */
    @OneToMany(fetch = FetchType.LAZY, mappedBy = "well", cascade = {CascadeType.REMOVE})
    @JsonIgnore
    private List<BA_TargetStratum> targetStratum;

    /**
     * 井身结构(一对多) BA_WELL_STRUCTURE
     */
    @OneToMany(fetch = FetchType.LAZY, mappedBy = "well", cascade = {CascadeType.REMOVE})
    @JsonIgnore
    private List<BA_WellStructure> wellStructure;

    /**
     * 地质分层(一对多) BA_STRATUM
     */
    @OneToMany(fetch = FetchType.LAZY, mappedBy = "well", cascade = {CascadeType.REMOVE})
    @JsonIgnore
    private List<BA_Stratum> stratum;

    /**
     * 地层岩性(一对多) BA_STRATUMLITHOLOGY
     */
    @OneToMany(fetch = FetchType.LAZY, mappedBy = "well", cascade = {CascadeType.REMOVE})
    @JsonIgnore
    private List<BA_StratumLithology> stratumLithology;

    /**
     * 地层温度(一对多) BA_STRATUMTEMPERATURE
     */
    @OneToMany(fetch = FetchType.LAZY, mappedBy = "well", cascade = {CascadeType.REMOVE})
    @JsonIgnore
    private List<BA_StratumTemperature> stratumTemperature;

    /**
     * 油气水层情况(一对多) BA_GAS_WATER_LAYER
     */
    @OneToMany(fetch = FetchType.LAZY, mappedBy = "well", cascade = {CascadeType.REMOVE})
    @JsonIgnore
    private List<BA_GasWaterLayer> gasWaterLayer;

    /**
     * 盐膏层及特殊情况(一对多) BA_SPECIALSTRATUM
     */
    @OneToMany(fetch = FetchType.LAZY, mappedBy = "well", cascade = {CascadeType.REMOVE})
    @JsonIgnore
    private List<BA_SpecialStratum> specialStratum;

    /**
     * 地层孔隙压力(一对多) BA_PORE_PRESSURE
     */
    @OneToMany(fetch = FetchType.LAZY, mappedBy = "well", cascade = {CascadeType.REMOVE})
    @JsonIgnore
    private List<BA_PorePressure> porePressure;

    /**
     * 地层破裂压力(一对多) BA_FRACTURE_PRESSURE
     */
    @OneToMany(fetch = FetchType.LAZY, mappedBy = "well", cascade = {CascadeType.REMOVE})
    @JsonIgnore
    private List<BA_FracturePressure> fracturePressure;

    /**
     * 地层坍塌压力(一对多) BA_COLLAPSE_PRESSURE
     */
    @OneToMany(fetch = FetchType.LAZY, mappedBy = "well", cascade = {CascadeType.REMOVE})
    @JsonIgnore
    private List<BA_CollapsePressure> collapsePressure;

    /**
     * 地层漏失压力(一对多) BA_LOSS_PRESSURE
     */
    @OneToMany(fetch = FetchType.LAZY, mappedBy = "well", cascade = {CascadeType.REMOVE})
    @JsonIgnore
    private List<BA_LossPressure> lossPressure;

    /**
     * 地漏实验(一对多) BA_FLOOR_DRAIN
     */
    @OneToMany(fetch = FetchType.LAZY, mappedBy = "well", cascade = {CascadeType.REMOVE})
    @JsonIgnore
    private List<BA_FloorDrain> floorDrain;

    /**
     * 海域信息(一对多) BA_SEA_AREA
     */
    @OneToMany(fetch = FetchType.LAZY, mappedBy = "well", cascade = {CascadeType.REMOVE})
    @JsonIgnore
    private List<BA_SeaArea> seaArea;

    /**
     * 钻具结构(一对多) DR_DRILL_TOOL_ASSEMBLY
     */
    @OneToMany(fetch = FetchType.LAZY, mappedBy = "well", cascade = {CascadeType.REMOVE})
    @JsonIgnore
    private List<DR_DrillToolAssembly> drillToolAssembly;

    /**
     * 钻头数据(一对多) DR_DRILL_BIT
     */
    @OneToMany(fetch = FetchType.LAZY, mappedBy = "well", cascade = {CascadeType.REMOVE})
    @JsonIgnore
    private List<DR_DrillBit> drillBit;

    /**
     * 钻井泵参数(一对多) DR_DRILLING_PUMP
     */
    @OneToMany(fetch = FetchType.LAZY, mappedBy = "well", cascade = {CascadeType.REMOVE})
    @JsonIgnore
    private List<DR_DrillingPump> drillingPump;

    /**
     * 井眼轨迹(一对多) DR_WELL_TRAJECTORY
     */
    @OneToMany(fetch = FetchType.LAZY, mappedBy = "well", cascade = {CascadeType.REMOVE})
    @JsonIgnore
    private List<DR_WellTrajectory> wellTrajectory;

    /**
     * 电测井径(一对多) DR_LOGGING_DIAMETER
     */
    @OneToMany(fetch = FetchType.LAZY, mappedBy = "well", cascade = {CascadeType.REMOVE})
    @JsonIgnore
    private List<DR_LoggingDiameter> loggingDiameter;

    /**
     * 电测温度(一对多) DR_LOGGING_TEMPERATURE
     */
    @OneToMany(fetch = FetchType.LAZY, mappedBy = "well", cascade = {CascadeType.REMOVE})
    @JsonIgnore
    private List<DR_LoggingTemperature> loggingTemperature;

    /**
     * 钻井情况(一对多) DR_DRILLING_SITUATION
     */
    @OneToMany(fetch = FetchType.LAZY, mappedBy = "well", cascade = {CascadeType.REMOVE})
    @JsonIgnore
    private List<DR_DrillingSituation> drillingSituation;

    /**
     * 通井情况(一对多) DR_DRIFTING_SITUATION
     */
    @OneToMany(fetch = FetchType.LAZY, mappedBy = "well", cascade = {CascadeType.REMOVE})
    @JsonIgnore
    private List<DR_DriftingSituation> driftingSituation;

    /**
     * 钻遇复杂情况(一对多) DR_COMPLEX
     */
    @OneToMany(fetch = FetchType.LAZY, mappedBy = "well", cascade = {CascadeType.REMOVE})
    @JsonIgnore
    private List<DR_Complex> complex;

    /**
     * 随钻实测数据(一对多) DR_MEASURED_DATA
     */
    @OneToMany(fetch = FetchType.LAZY, mappedBy = "well", cascade = {CascadeType.REMOVE})
    @JsonIgnore
    private List<DR_MeasuredData> measuredData;

    /**
     * 钻井期间实录数据(一对多) DR_LOG_DATA
     */
    @OneToMany(fetch = FetchType.LAZY, mappedBy = "well", cascade = {CascadeType.REMOVE})
    @JsonIgnore
    private List<DR_LogData> logData;

    /**
     * 钻井液设计数据(一对多) DR_FLUID_DESIGN
     */
    @OneToMany(fetch = FetchType.LAZY, mappedBy = "well", cascade = {CascadeType.REMOVE})
    @JsonIgnore
    private List<DR_FluidDesign> fluidDesign;

    /**
     * 钻井期间钻井液性能(一对多) DR_FLUID_PERFORMANCE
     */
    @OneToMany(fetch = FetchType.LAZY, mappedBy = "well", cascade = {CascadeType.REMOVE})
    @JsonIgnore
    private List<DR_FluidPerformance> fluidPerformance;

    /**
     * 固井基本信息(一对多) CM_BASIC
     */
    @OneToMany(fetch = FetchType.LAZY, mappedBy = "well", cascade = {CascadeType.REMOVE})
    @JsonIgnore
    private List<CM_Basic> cementBasic;

    /**
     * 固前钻井液性能数据(一对多) CM_FLUID_PERFORMANCE
     */
    @OneToMany(fetch = FetchType.LAZY, mappedBy = "well", cascade = {CascadeType.REMOVE})
    @JsonIgnore
    private List<CM_FluidPerformance> cm_fluidPerformance;

    /**
     * 固井前录井实测数据(一对多) CM_LOG_DATA
     */
    @OneToMany(fetch = FetchType.LAZY, mappedBy = "well", cascade = {CascadeType.REMOVE})
    @JsonIgnore
    private List<CM_LogData> cm_logData;

    /**
     * 水质检验(一对多) CM_WATER_TEST
     */
    @OneToMany(fetch = FetchType.LAZY, mappedBy = "well", cascade = {CascadeType.REMOVE})
    @JsonIgnore
    private List<CM_WaterTest> waterTest;

}
